package cn.edu.scau.cmi.chenzehan.combinationPattern.transparentCombination;

import java.util.ArrayList;

public class Composite extends Organization{

	private ArrayList<Organization> organPerson = new ArrayList<Organization>();
	@Override
	public String print() {
		String message = "";
		for(Organization p:organPerson) {
			if(p instanceof Person) {
				message+=("姓名:"+((Person) p).getName()+"  年龄"+((Person) p).getAge()+"\n");
			}
			
		}
		return message;
	}
	public ArrayList<Organization> getOrganPerson() {
		return organPerson;
	}
	public void setOrganPerson(ArrayList<Organization> organPerson) {
		this.organPerson = organPerson;
	}
	public void add(Organization p) {
		organPerson.add(p);
	}
    public void remove(Organization p) {
    	organPerson.remove(p);
    }
	
	
}
